import request from '@/utils/request'
import { CURDApiBase } from '../curd-api-base'


export default new class RequirementApi extends CURDApiBase {
  constructor() {
    super('/wms-order/api/requirement')
  }

  // 根据项目查询库存
  clacRequire(id?: string) {
    return request({
      url: `${this.baseUrl}/clacRequire/` + id,
      method: 'put'
    })
  }

  /** 根据项目id查询物料清单（含清单物料数据及物料库存数据） */
  listCount(data?: any) {
    return request({
      url: `${this.baseUrl}/listcount`,
      method: 'post',
      data
    })
  }

  /** 导入物料清单 */
  uploadMultiple(data?: any) {
    return request({
      headers: {
        'content-Type': 'multipart/form-data'
      },
      url: `${this.baseUrl}/import_multiple`,
      method: 'post',
      data
    })
  }


  /** 导入请购单 */
  upload(data?: any) {
    return request({
      headers: {
        'content-Type': 'multipart/form-data'
      },
      url: `${this.baseUrl}/import`,
      method: 'post',
      data
    })
  }

  /**导入清单后保存 */
  batchSave(data: any): any {
    return request({
      url: `${this.baseUrl}/batchSave`,
      method: 'post',
      data
    })
  }

  /** 查询项目是否到货 */
  clacAllRequire() {
    return request({
      url: `${this.baseUrl}/compareAllRequire`,
      method: 'post'
    })
  }
}()

